  import request from '@/utils/request'

  export const login = (data) =>{
    return request({
      url: '/api/user/login',
      method: 'post',
      data
    })
  }

  export const getLoginInfo = () =>{
    return request({
      url: '/api/user/get/login',
      method: 'get'
    })
  }

  export const upload = (data) =>{
    return request({
      url: '/api/file/upload',
      method: 'post',
      data
    })
  }

  /**
   * 检查文件上传状态
   * @param {Object} data 
   * @returns 
   */
  export const chunkFileCheck  = (fileHash) =>{
    return request({
      url: '/api/chunk/file/check/'+fileHash,
      method: 'post', 
    })
  }

  /**
   * 分片文件上传
   * @param {Object} data 
   * @param {Function} onUploadProgress 
   * @returns 
   */
  export const chunkFileUpload = (data,onUploadProgress) =>{
    return request({
      url: '/api/chunk/file/upload',
      method: 'post',
      data,
      headers: {
        'Content-Type': 'multipart/form-data'
      }, 
      onUploadProgress 
    })
  }

  /**
   * 合并分片文件
   * @param {Object} data 
   * @returns 
   */
  export const mergeChunkFile = (data) =>{
    return request({
      url: '/api/chunk/file/merge',
      method: 'post',
      data
    })
  }

